package com.zz.study.sharding.entity;

import com.zz.study.sharding.util.DateSplitUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * created by xjx on  2023-10-18 11:33
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DateSplit {

        private Date startDateTime;
        private Date endDateTime;

        public String getStartDateTimeStr() {
            return DateSplitUtils.formatDateTime(startDateTime);
        }

        public String getEndDateTimeStr() {
            return DateSplitUtils.formatDateTime(endDateTime);
        }

        @Override
        public String toString() {
            return
                    getStartDateTimeStr() +
                    "~" + getEndDateTimeStr();
        }

}
